home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 2.4 KB | 100 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: PRGrRef.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef PRGRREF_H
- #include "PRGrRef.h"
- #endif
-
- #ifndef FWPRIDEB_H
- #include "FWPriDeb.h"
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment FW_Graphics
- #endif
-
- FW_DEFINE_AUTO(FW_CPrivGrRefPtrBase)
-
- //========================================================================================
- // class FW_CPrivGrRefObj
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivGrRefObj::FW_CPrivGrRefObj
- //----------------------------------------------------------------------------------------
-
- FW_CPrivGrRefObj::FW_CPrivGrRefObj() :
- fRefCount(0)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivGrRefObj::~FW_CPrivGrRefObj
- //----------------------------------------------------------------------------------------
-
- FW_CPrivGrRefObj::~FW_CPrivGrRefObj()
- {
- FW_ASSERT(fRefCount == 0);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivGrRefObj::Release
- //----------------------------------------------------------------------------------------
-
- void FW_CPrivGrRefObj::Release()
- {
- if (-- fRefCount == 0)
- delete this;
- }
-
- //========================================================================================
- // class FW_CPrivGrRefPtrBase
- //========================================================================================
-
- FW_CPrivGrRefPtrBase::FW_CPrivGrRefPtrBase(FW_CPrivGrRefObj* rep) :
- fRep(rep)
- {
- if (fRep != 0)
- fRep->Acquire();
-
- FW_END_CONSTRUCTOR
- }
-
- FW_CPrivGrRefPtrBase::FW_CPrivGrRefPtrBase() :
- fRep(0)
- {
- FW_END_CONSTRUCTOR
- }
-
- FW_CPrivGrRefPtrBase::~FW_CPrivGrRefPtrBase()
- {
- FW_START_DESTRUCTOR
-
- if (fRep != 0)
- fRep->Release();
- }
-
- void FW_CPrivGrRefPtrBase::SetRep(FW_CPrivGrRefObj* rep)
- {
- if (rep != 0)
- rep->Acquire();
-
- if (fRep != 0)
- fRep->Release();
-
- fRep = rep;
- }
-
-